﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;

namespace lcmyjobs.Web.invite
{
    public partial class reward : System.Web.UI.Page
    {
        lcmyjobs.BLL.user_basic bub = new BLL.user_basic();
        DataSet ds;
        int count = 0;
        int id;
        protected void Page_Load(object sender, EventArgs e)
        {
            id = int.Parse(Application["webid"].ToString());
            if (!IsPostBack)
            {

                this.Title = string.Format("悬赏求职   人才网   招聘网   求职网   猎头网   {0}", Application["webname"].ToString());
                getcout(id);
                //bindData(); //使用url分页，只需在分页事件处理程序中绑定数据即可，无需在Page_Load中绑定，否则会导致数据被绑定两次
            }


        }
        public string showday(string a)
        {
            int i = int.Parse(a);
            if (i >= 0)
                return a + "天";
            else
                return "过期";
        }
        protected void getcout(int atid)
        {
            ds = bub.PageUserRewardList(atid, 1, AspNetPager1.PageSize, out count);
            AspNetPager1.RecordCount = count;
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();

        }
        protected void bind(int atid)
        {
            ds = bub.PageUserRewardList(atid, AspNetPager1.StartRecordIndex, AspNetPager1.PageSize, out count);
            AspNetPager1.RecordCount = count;
            GridView1.DataSource = ds.Tables[0];
            GridView1.DataBind();

        }

        public string GetStrSub(string str, int length)
        {
            if (str.Length > length)
            {
                return str.Substring(0, length) + "...";
            }
            else
            {
                return str;
            }
        }


        protected void AspNetPager1_PageChanged(object sender, EventArgs e)
        {
            id = int.Parse(Application["webid"].ToString());
            bind(id);

        }

    }
}